1. Field of the Invention
This invention relates to microprocessors. In particular, the invention relates to a performance monitor.
2. Description of Related Art
Performance monitors detect and count specific events in a micro circuit such as a microprocessor. By accumulating and reporting different types of events, it is possible to produce a performance profile for an operating system or applications. This enables a software architect to fine tune the code of the applications or the operating system to improve performance. Examples of events detected by such monitors include on-chip cache miss, instruction cache miss, load buffers full, store buffers full, etc.
As microprocessor technology is becoming more and more advanced, existing performance monitors may not provide satisfactory results. Advanced microprocessors typically have speculative architecture and high degree of complexity.
For a speculative processor, performance data from such monitors include actual as well as speculative information. Speculative information may be correctly predicted or mis-predicted. When there is mis-prediction, performance data may be erroneously reported.
In addition, complexity in hardware architecture of modern microprocessors creates difficulties in monitoring performance. Highly integrated processors have multiple functional units designed to support many instructions. Monitoring effects of instruction execution at these functional units is complex and requires extensive supporting circuits.
Therefore, there is a need to have a performance monitor that can eliminate errors in speculative processing and improve efficiency.
The present invention is a method and apparatus to monitor performance of a processor. A performance specifier specifies a performance data corresponding to the performance. The performance data includes an event and an instruction causing the event. A tag generator is coupled to the performance specifier to generate a performance tag associated with the instruction. The performance tag is stored in a storage. A retirement performance monitor is coupled to the storage to extract the performance tag when the instruction is retired.